/*
 * Created on 16/Dez/2004
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package ceirinhashls;

import java.util.Comparator;

/**
 * @author botelhodaniel
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class DCHubComparator implements Comparator {

	/* (non-Javadoc)
	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
	 */
	public int compare(Object arg0, Object arg1) {
		// TODO Auto-generated method stub
            //System.out.println(arg0+" -> "+arg1);
		if(arg0 instanceof String)
                    if(arg1 instanceof String)
                        return ((String)arg0).trim().compareTo(((String)arg1));
                    else
			return ((String)arg0).trim().compareTo(((DCHub)arg1).getAddress());
		return ((DCHub)arg0).getAddress().compareTo(((DCHub)arg1).getAddress());
	}

}
